The Pramac Racing rider was leading on the penultimate of 30 laps around the Sachsenring when he went down at Turn 1.
Bagnaia inherited first position and now heads the championship by 10 points over his Ducati stablemate as MotoGP summer break begins.
Marc Marquez charged from 13th to second with Alex Marquez making it both Gresini Ducatis on the podium.
Jack Miller finished 13th on his Red Bull KTM and Remy Gardner was classified 19th as he stood in for the injured Alex Rins at Monster Energy Yamaha.
Martin had qualified on pole position and kept Miguel Oliveira (Trackhouse Aprilia) at bay in the opening corners, before the latter was passed for second by Bagnaia at Turn 13 after he had launched well from the second row.
A lap later, Bagnaia hit the front with a carbon copy of that move, but on Martin.
Franco Morbidelli had moved up to third place and then started applying pressure to his Pramac team-mate as that top three gapped the field.
Martin survived and then went back past Bagnaia at Turn 1 on 7, before Morbidelli did likewise to relegate the #1 Ducati Team entry to third on Lap 9.
Bagnaia was back into second place at the halfway mark when he found a way past at Turn 13, by which time #89 was more than a second to the good.
Meanwhile, Alex Marquez and Marc Marquez were on the climb in the next group, the former overtaking Morbidelli on Lap 17.
When Morbidelli ran wide at Turn 1 on Lap 22, Marc Marquez went for the gap but the Italian cut back and they banged together, causing #93 to come under huge pressure from Enea Bastianini.
The six-time champ ultimately shook off the man whom he is replacing at the Ducati Team next year, then lunged past Morbidelli at Turn 13 on Lap 25.
At the very front, Martin’s gap had dwindled to half a second when he slid out and into the gravel trap with two laps to go, before Marc Marquez went under his brother at Turn 12 for what had become second place.
Bagnaia won by 3.804s with Marc Marquez second, from Alex Marquez, Bastianini, Morbidelli, Oliveira, Pedro Acosta (GasGas Tech3), Marco Bezzecchi (VR46 Ducati), Brad Binder (Red Bull KTM), Raul Fernandez (Trackhouse Aprilia) in 10th, Fabio Quartararo (Monster Energy Yamaha), Maverick Viñales (Aprilia Racing), and Miller.
Augusto Fernandez (GasGas Tech3) had taken the chequered flag in 14th but a penalty for a tyre pressure breach meant his spot was inherited by Takaaki Nakagami (LCR Honda), and Luca Marini (Repsol Honda) scored his first championship point of the season by being officially classified 15th.
Gardner likewise moved up one spot from 20th, ahead of Stefan Bradl (HRC Honda).
Round 10 is the British Grand Prix at Silverstone on August 2-4.
Race results: Grand Prix race
Pos | Num | Rider | Nat | Team | Bike | Time/Gap |
1 | 1 | F. Bagnaia | ITA | Ducati Lenovo Team | Ducati | 40:40.063 |
2 | 93 | M. Marquez | ESP | Gresini Racing MotoGP | Ducati | +3.804 |
3 | 73 | A. Marquez | ESP | Gresini Racing MotoGP | Ducati | +4.334 |
4 | 23 | E. Bastianini | ITA | Ducati Lenovo Team | Ducati | +5.317 |
5 | 21 | F. Morbidelli | ITA | Prima Pramac Racing | Ducati | +5.557 |
6 | 88 | M. Oliveira | POR | Trackhouse Racing | Aprilia | +10.481 |
7 | 31 | P. Acosta | ESP | Red Bull GASGAS Tech3 | GasGas | +14.746 |
8 | 72 | M. Bezzecchi | ITA | Pertamina Enduro VR46 Racing Team | Ducati | +14.930 |
9 | 33 | B. Binder | RSA | Red Bull KTM Factory Racing | KTM | +15.084 |
10 | 25 | R. Fernandez | ESP | Trackhouse Racing | Aprilia | +16.384 |
11 | 20 | F. Quartararo | FRA | Monster Energy Yamaha MotoGP Team | Yamaha | +17.235 |
12 | 12 | M. Viñales | ESP | Aprilia Racing | Aprilia | +18.865 |
13 | 43 | J. Miller | AUS | Red Bull KTM Factory Racing | KTM | +25.425 |
14 | 30 | T. Nakagami | JPN | IDEMITSU Honda LCR | Honda | +25.817 |
15 | 10 | L. Marini | ITA | Repsol Honda Team | Honda | +25.854 |
16 | 37 | A. Fernandez | ESP | Red Bull GASGAS Tech3 | GasGas | +41.495 |
17 | 5 | J. Zarco | FRA | CASTROL Honda LCR | Honda | +41.952 |
18 | 36 | J. Mir | ESP | Repsol Honda Team | Honda | +43.145 |
19 | 87 | R. Gardner | AUS | Monster Energy Yamaha MotoGP Team | Yamaha | +50.115 |
20 | 6 | S. Bradl | GER | HRC Test Team | Honda | +59.047 |
DNF | 89 | J. Martin | ESP | Prima Pramac Racing | Ducati | 28 laps |
DNF | 49 | F. Di Giannantonio | ITA | Pertamina Enduro VR46 Racing Team | Ducati | 9 laps |
Race winner: 30 laps
Riders’ championship
Pos | Rider | Nat | Pts |
1 | F. Bagnaia | ITA | 222 |
2 | J. Martin | ESP | 212 |
3 | M. Marquez | ESP | 166 |
4 | E. Bastianini | ITA | 155 |
5 | M. Viñales | ESP | 125 |
6 | P. Acosta | ESP | 110 |
7 | B. Binder | RSA | 108 |
8 | F. Di Giannantonio | ITA | 92 |
9 | A. Espargaro | ESP | 82 |
10 | A. Marquez | ESP | 79 |
11 | F. Morbidelli | ITA | 55 |
12 | M. Bezzecchi | ITA | 53 |
13 | M. Oliveira | POR | 51 |
14 | R. Fernandez | ESP | 46 |
15 | F. Quartararo | FRA | 44 |
16 | J. Miller | AUS | 35 |
17 | A. Fernandez | ESP | 15 |
18 | J. Mir | ESP | 13 |
19 | J. Zarco | FRA | 12 |
20 | T. Nakagami | JPN | 10 |
21 | A. Rins | ESP | 8 |
22 | D. Pedrosa | ESP | 7 |
23 | L. Marini | ITA | 1 |
24 | S. Bradl | GER | 0 |
25 | P. Espargaro | ESP | 0 |
26 | R. Gardner | AUS | 0 |
27 | L. Savadori | ITA | 0 |